package com.gis.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.gis.bean.GoodsType;
import com.gis.dao.GoodsTypeDao;

import com.gis.util.ResponseUtil;
import com.gis.util.RestResponse;

@WebServlet("/goodsType/list")
public class GetAllGoodsTypeServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private GoodsTypeDao goodsTypeDao = new GoodsTypeDao();

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		/*
		 * MailContext mailContext = new MailContext();
		 * mailContext.setTo("898783575@qq.com"); mailContext.setSubject("密码找回");
		 * mailContext.setContent("<p>您的验证码是<b>098620</b></p>");
		 * SendMessage.send(mailContext);
		 */
		
		List<GoodsType> goodsTypeList = goodsTypeDao.listAll();
		ResponseUtil.writeJson(resp, RestResponse.success(goodsTypeList));
	}
	

}
